package com.dapeis.im.tim;

/**
 * @author 作者 E-mail: hzyuanyong@126.com
 * @version 创建时间：2017年5月18日 下午6:03:02 
 * @see https://www.qcloud.com/document/product/269/1520
 * 腾讯云REST API列表
 */
public class TIMURL {
    /**
     * 基础域名
     */
    public static final String BASE = "https://console.tim.qq.com/";
    /**
     * 单个导入账号
     */
    public static final String IMPORT_ACCOUNT = "v4/im_open_login_svc/account_import";
    /**
     * 设置应用属性
     */
    public static final String IM_SET_SYS_ATTR_NAME = "v4/openim/im_set_attr_name";
    /**
     * 获取应用属性
     */
    public static final String IM_GET_SYS_ATTR_NAME = "v4/openim/im_get_attr_name";
    /**
     * 设置用户(搭配师)属性
     */
    public static final String IM_SET_USER_ATTR = "v4/openim/im_set_attr";
    /**
     * 添加好友
     */
    public static final String IM_ADD_FRIEND = "v4/sns/friend_add";

    /**
     * 获取好友列表
     */
    public static final String IM_GET_FRIEND = "v4/sns/friend_get_all";

    
    public static final String IM_CHECK_FRIEND = "/v4/sns/friend_check";
    /**
     * 设置资料
     */
    public static final String IM_PROFILE_SET = "v4/profile/portrait_set";

    /**
     * 获取资料
     */
    public static final String IM_PROFILE_GET = "v4/profile/portrait_get";
    
    /**
     * 批量发送消息
     */
    public static final String IM_BATCH_SEND_MSG ="v4/openim/batchsendmsg";
    /**
     * 单个发送消息
     */
    public static final String IM_SINGLE_SEND_MSG = "v4/openim/sendmsg";

    /**
     * 获取地址
     * 
     * @param _urlName
     * @return
     */
    public static String get(String _urlName) {
	StringBuffer urlBuffer = new StringBuffer().append(BASE).append(
		_urlName);
	return getClientURL(urlBuffer.toString());
    }

    /**
     * 组装请求参数URL
     * 
     * @param url
     * @return
     */
    private static String getClientURL(String url) {
	StringBuffer urlParm = new StringBuffer().append(url)
		.append("?usersig=")
		.append(TIMConfig.TIM_SYS_ACCOUNT_SINGATURE)
		.append("&identifier=").append(TIMConfig.TIM_SYS_ACCOUT)
		.append("&sdkappid=").append(TIMConfig.APPID.toString())
		.append("&contenttype=json");
	return urlParm.toString();
    }
}
